package com.training.java.core.collections.immutablecar.post15;

public final class Car  {

	private String make;
	private String model;
	private int year;

	// private int price;
	
	public Car(){
		
	}

	public Car(String make, String model, int year) {

		this.make = make;
		this.model = model;
		this.year = year;

	}

	public String getMake() {
		return make;
	}

	public String getModel() {
		return model;
	}

	public int getYear() {
		return year;
	}

	// public int getPrice() {
	// return price;
	// }
	//
	// public void setPrice(int price) {
	// this.price = price;
	// }
	

	@Override
	public String toString() {
		return "Car [make=" + make + ", model=" + model + ", year=" + year
				+ ", getClass()=" + getClass() + ", hashCode()=" + hashCode()
				+ ", toString()=" + super.toString() + "]";
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return this.model.hashCode() + this.make.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		if (obj instanceof Car) {

			Car car = (Car) obj;

			return this.make.equals(car.make) && this.model.equals(car.model);

		}
		return false;
	}

}
